<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head lang="en">
		<meta charset="utf-8" />
		<title>个人信息</title>
		<link rel="stylesheet" type="text/css" href="<%=basePath%>frontPage/css/public.css"/>
		<link rel="stylesheet" type="text/css" href="<%=basePath%>frontPage/css/mygrxx.css" />
	</head>
	<body>
		<!------------------------------head------------------------------>
		<jsp:include page="header1.jsp"></jsp:include>
		<!------------------------------idea------------------------------>
		<div class="address mt">
			<div class="wrapper clearfix">
				<a href="" class="fl">首页</a>
				<span>/</span>
				<a href="" class="on">个人信息</a>
			</div>
		</div>
		
		<!------------------------------Bott------------------------------>
		<div class="Bott">
			<div class="wrapper clearfix">
				<div class="zuo fl">
					<h3>
						<a href="#"><img src="<%=basePath%>frontPage/img/tx.png"/></a>
						<p class="clearfix"><span class="fl">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${user.name }</span></p>
					</h3>
					<div>
						<h4>我的交易</h4>
						<ul>
							<li><a href="<%=basePath%>toShoppingCartPage/${userId}">我的购物车</a></li>
							<li><a href="<%=basePath%>findOrderInfo/${userId}/5">我的订单</a></li>
						</ul>
						<h4>个人中心</h4>
						<ul>
							<li><a href="<%=basePath%>toAddressPage/${userId}">地址管理</a></li>
						</ul>
						<h4>账户管理</h4>
						<ul>
							<li class="on"><a href="<%=basePath%>tomymessagePage/${userId}">个人信息</a></li>
							<li><a href="<%=basePath%>changepassword/${userId}">修改密码</a></li>
						</ul>
					</div>
				</div>
				<div class="you fl">
					<h2>个人信息</h2>
					<div class="gxin">
						<div class="tx"><a href="#"><img src="<%=basePath%>frontPage/img/tx.png"/></a></div>											
							<div class="xx">
								<h3 class="clearfix"><strong class="fl">基础资料</strong><a href="#" class="fr" id="edit1">编辑</a></h3>
								<div>姓名：${user.name}</div>
								<div>生日：${user.birthday}</div>
								<div>性别：${user.gender}</div>
								<div>电话：${user.phone}</div>
							</div>
					</div>			
				</div>
			</div>
		</div>
				<!--遮罩-->
		<div class="mask"></div>
		<!--编辑弹框-->
		<div class="bj">
			<div class="clearfix"><a href="#" class="fr gb"><img src="<%=basePath%>frontPage/img/icon4.png"/></a></div>
			<h3>编辑基础资料</h3>
			<form action="" method="post" id="userIdInfo">
			    <input type="hidden" value="${user.id }" name="id">
				<p><label>姓名：</label><input type="text" value="${user.name}" id="name" name="name"/></p>				
				<p><label>生日：</label><input type="text" value="${user.birthday}" id="birthday" name="birthday"/></p>
				<p>
					<label>性别：</label>
					<c:if test="${user.gender=='男' }">
						<span><input style="width: 15px;height: 15px" type="radio" name="gender" value="男" checked="checked" id="gender"/>男</span>
						<span><input style="width: 15px;height: 15px" type="radio" name="gender" value="女" id="gender1"/>女</span>
					</c:if>
					<c:if test="${user.gender=='女' }">
						<span><input style="width: 15px;height: 15px" type="radio" name="gender" value="男" id="gender"/>男</span>
						<span><input style="width: 15px;height: 15px" type="radio" name="gender" value="女" checked="checked" id="gender1"/>女</span>
					</c:if>					
				</p>
				<p><label>电话：</label><input type="text" value="${user.phone}" id="phone" name="phone"/></p>
				<div class="bc">
					<input type="button" id="update" value="保存"  />
					<input type="button" value="取消" />
				</div>
			</form>
		</div>
		<!--修改头像-->
		<div class="avatar">
			<div class="clearfix"><a href="#" class="fr gb"><img src="<%=basePath%>frontPage/img/icon4.png"/></a></div>
			<h3>修改头像</h3>
			<form action="#" method="get">
				<h4>请上传图片</h4>
				<input type="button" value="上传头像" />
				<p>jpg或png，大小不超过2M</p>
				<input type="submit" value="提交" />
			</form>
		</div>
		
		<!--返回顶部-->
		<jsp:include page="gotop.jsp"></jsp:include>
		<!--footer-->
		<jsp:include page="footer.jsp"/>
		<script src="<%=basePath%>frontPage/js/jquery-1.12.4.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="<%=basePath%>frontPage/js/public.js" type="text/javascript" charset="utf-8"></script>
		<script src="<%=basePath%>frontPage/js/user.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript">
		$(function () {
	        $('#update').click(function () {	    
	        	var userInfo = $("#userIdInfo").serialize();
     		    $.ajax({
					url:'<%=basePath%>toeditmymessagePage/${userId}',
					data:userInfo,
					type:'post',
					success: function(data){
						alert("修改成功！！");
						window.location.reload();
					},
					error:function(){
						alert("修改失败！！");
						window.location.reload();
			 		}
				})       	            
	        });
	    });  
	</script>
	</body>
</html>
